#{extends 'adminm/frame.html' /}

#{set 'moreStyles'}
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/edit.scss'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/common.scss'}" />
<link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/Users/commodity.scss'}" />
#{/set}
#{set 'moreScripts'}
<script src="@{'/public/pager/jquery.pager.js'}" type="text/javascript" charset="utf-8"></script>
#{/set}
#{set 'activeItem'}4#{/set}
<script language="javascript">
$(function(){
	$("#mi_order").addClass("menu-select");
});
</script>
<div class="navigationBar">
	<table>
		<tr>
			<td><img src="@{'/public/images/navigationHouse.gif'}"></td>
			<td><strong>当前位置：</strong></td>
			<td>
				<a href="/">首页</a>
				>>
				<a href="/users">会员中心</a>
				>>
				<a href="/users/order">订单管理</a>
				>>
				<font class="current">订单详细情况</font>
			</td>
		</tr>
	</table>
</div>
<script language="javascript">
function goback() {
	window.location.href="/admin/order/remittanceConfirm";
}

function confirmMoney(isPass) {
	var id = $("#remittanceConfirmId").val();
	var common = $("#msgContent").val();
	dataStr="id="+id+"&common="+common+"&isPass="+isPass;
	$.ajax({
		url: "/admin/order/updateConfirm",
		data: dataStr,
		type: "POST",
		dataType: "json",
		complete: function(XMLHttpRequest, textStatus, errorThrown) {
			if(textStatus == "error") {
				var errJson = eval("("+XMLHttpRequest.responseText+")");
				var errMsg = "操作失败，"+errJson.message;
				$("#errMsg").html(errMsg);
				alert(errMsg);
			}
			window.location.href="/admin/order/remittanceConfirm";
		}
	});
}
function deleteItem(id) {
	if(!confirm("确定删除此记录("+id+")？")) return;
	$.ajax({
		url: "/admin/order/remittanceConfirm/"+id,
		//data: dataStr,
		type: "DELETE",
		dataType: "json",
		complete: function(XMLHttpRequest, textStatus, errorThrown) {
			if(textStatus == "error") {
				var errJson = eval("("+XMLHttpRequest.responseText+")");
				var errMsg = "操作失败，"+errJson.message;
				$("#errMsg").html(errMsg);
				alert(errMsg);
			}
			goback();
		}
	});
}
</script>
</table>
<div id="edit-comment">
	<input type="button" value="返回上页" onClick="goback()">&nbsp;&nbsp;&nbsp;
	<input type="button" value="删除记录" onClick="deleteItem(${remittanceConfirm.id})">
	<table>
		<tr>
			<td weight="200px;">确认单号：</td>
			<td weight="300px;">${remittanceConfirm.id}</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td>银行名称：</td>
			<td><font class="important_2">${remittanceConfirm.bankName}</font></td>
			<td>支付方式：</td>
			<td>
				<font class="important_2">
				#{if remittanceConfirm.payType=="online"}在线支付#{/if}
				#{if remittanceConfirm.payType=="bankTransfer"}银行转账#{/if}
				</font>
			</td>
		</tr>
		<tr>
			<td>支付人：</td>
			<td><font class="important_2">${remittanceConfirm.paierName}</font></td>
			<td weight="200px;">实付金额:</td>
			<td weight="25%"><font class="price">${remittanceConfirm.price}</font></td>
		</tr>
		<tr>
			<td>电话：</td>
			<td>${remittanceConfirm.phone}</td>
			<td>E-mail:</td>
			<td>${remittanceConfirm.email}</td>
		</tr>
		<tr>
			<td>地址：</td>
			<td colspan="3">${remittanceConfirm.address}</td>
		</tr>
		<tr>
			<td>确认单状态：</td>
			<td>
				#{if remittanceConfirm.confirmStatus == models.RemittanceConfirm.ConfirmStatus.NEW}
					<font class="important">请求确认中</font>
				#{/if}
				#{if remittanceConfirm.confirmStatus == models.RemittanceConfirm.ConfirmStatus.PASS}
					<font class="important_2">确认成功</font>
				#{/if}
				#{if remittanceConfirm.confirmStatus == models.RemittanceConfirm.ConfirmStatus.FAIL}
					<font class="">确认失败</font>
				#{/if}
			</td>
			<td>确认管理员：</td>
			<td>
				#{if remittanceConfirm.admin}
					${remittanceConfirm.admin.username}
				#{/if}
			</td>
		</tr>
		<tr>
			<td>附加说明：</td>
			<td colspan="3">${remittanceConfirm.remark}</td>
		</tr>
		#{if remittanceConfirm.confirmStatus == models.RemittanceConfirm.ConfirmStatus.NEW}
		<tr>
			<td>原因说明：</td>
			<td colspan="3" align="center">
				<input id="remittanceConfirmId" type="hidden" value="${remittanceConfirm.id}">
				<input id="msgContent" type="text" style="width:100%;height:70px;" maxlength="200"></input>
				<br>
				<input type="button" value="确认通过" onClick="confirmMoney(true)">&nbsp;&nbsp;&nbsp;
				<input type="button" value="确认不通过" onClick="confirmMoney(false)">
			</td>
		</tr>
		#{/if}
	</table>
	#{users/orderDetail order:remittanceConfirm.order /}
</div>

<center><input type="button" value="返回上页" onclick="goback()"></center>
<br><br>